<%@ page import="java.util.List" %>
<%@ page import="cn.com.entity.Comment" %>
<%@ page import="cn.com.controler.Comment.CommentDAO" %><%--
  Created by IntelliJ IDEA.
  User: DELL
  Date: 2020/10/9
  Time: 23:07
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>我的评论</title>
    <script src="/WebContent/JQuery/jquery-3.4.1.js"></script>
    <style>
         table{
             width: 800px;
             margin: 0 auto;
             margin-top: 50px;
             table-layout: fixed;
         }
        td{
            text-align: center;
            width: 25%;
            height: 30px;
        }
    </style>
</head>
<body>
<table border="1">
    <tr>
        <th>时间</th>
        <th>评论对象</th>
        <th>评论内容</th>
        <th>操作</th>
    </tr>
    <%
        request.setCharacterEncoding("utf-8");
        List usercomment = (List)session.getAttribute("usercomment");
        CommentDAO commentDAO = new CommentDAO();
        Comment comment;
        Integer commentArtId;
        String getdxname;
        if(usercomment.size() !=0){
            for (int i = 0; i < usercomment.size(); i++) {
                comment = (Comment)usercomment.get(i);
                commentArtId = comment.getCommentArtId();
                //获取评论对象姓名
                getdxname = commentDAO.getdxname(commentArtId);
    %>
    <tr>
        <td><%=comment.getCommentTime()%></td>
        <td><%=getdxname%></td>
        <td><%=comment.getCommentContent()%></td>
        <td class="btn" style="cursor: pointer" ><a href="/CommentDML?czlx=delete&commentid=<%=comment.getCommentId()%>">删除</a></td>
    </tr>
<%
    }
}else{
%>
<tr>
    <td colspan="4">
        您没有评论！
    </td>
</tr>
<%
    }
%>
</table>
<script src="/WebContent/JQuery/jquery-3.4.1.js"></script>
<script>
    $(document).ready(function () {
         $("a").click(function () {
              window.location.reload();
         })
    })
</script>
</body>
</html>
